package com.lankystar.logistucs.spring.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="user")
public class User {
/**
 * ID、手机、用户名、密码、驾驶证、用户与公司关系、用户与地址关系、用户类型、时间戳
 */
	private int userId;
	private String userPhone;
	private String userName;
	private String userPassword;
	private String drivLicence;
	private String address;
	private UserType userType;
	private TruckStatus truckStatus;//司机状态  与  车状态一致
	private Company company;
	private int usual;//0可用、1不可用
	private int remove;//0未删除、1删除
	private long createTime;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	@Column
	public String getUserPhone() {
		return userPhone;
	}
	public void setUserPhone(String userPhone) {
		this.userPhone = userPhone;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPassword() {
		return userPassword;
	}
	public void setUserPassword(String userPassword) {
		this.userPassword = userPassword;
	}
	
	public String getDrivLicence() {
		return drivLicence;
	}
	public void setDrivLicence(String drivLicence) {
		this.drivLicence = drivLicence;
	}
	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="userType_Id")
	public UserType getUserType() {
		return userType;
	}
	public void setUserType(UserType userType) {
		this.userType = userType;
	}
	public long getCreateTime() {
		return createTime;
	}
	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}
	public int getUsual() {
		return usual;
	}
	public void setUsual(int usual) {
		this.usual = usual;
	}
	public int getRemove() {
		return remove;
	}
	public void setRemove(int remove) {
		this.remove = remove;
	}
	@ManyToOne()
	@JoinColumn(name="truckStatus_Id")
	public TruckStatus getTruckStatus() {
		return truckStatus;
	}
	public void setTruckStatus(TruckStatus truckStatus) {
		this.truckStatus = truckStatus;
	}
	@ManyToOne
	@JoinColumn(name="company_Id")
	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
}
